<template>
  <layout-content>
  <div class="mui-content">
    <!-- 工作界面 -->
    <div id="work" class="mui-control-content mui-active">
      <header class="mui-bar mui-bar-nav">
        <h1 class="mui-title">湖南永州监狱智慧党建</h1>
        <div class="mui-pull-right header-right flex-center" style="height: 100%;">
          <div v-if="isDwb()" class="approve-icon flex-center" @click="goApprove()">
            <img src="../../static/images/shenpi.png" alt="">
            <span v-if="dwbPactchUpApprovaCount>0" class="mui-badge mui-badge-danger">{{dwbPactchUpApprovaCount}}</span>
          </div>
          <img @click="capture" src="../../static/images/saoyisao.png" />
        </div>
      </header>

      <!-- 轮播图  start -->
      <div class="banner-content">
        <div class="mui-slider">
          <div class="mui-slider-group mui-slider-loop">
            <!--支持循环，需要重复图片节点-->
            <div class="mui-slider-item mui-slider-item-duplicate"><a href="javascript:void(0)"><img src="../../static/images/slidepic.jpg" width="100%" /></a></div>
            <div class="mui-slider-item"><a href="javascript:void(0)"><img src="../../static/images/slidepic.jpg" width="100%" /></a></div>
            <div class="mui-slider-item"><a href="javascript:void(0)"><img src="../../static/images/slidepic.jpg" width="100%" /></a></div>
            <div class="mui-slider-item"><a href="javascript:void(0)"><img src="../../static/images/slidepic.jpg" width="100%" /></a></div>
            <!--支持循环，需要重复图片节点-->
            <div class="mui-slider-item mui-slider-item-duplicate"><a href="javascript:void(0)"><img src="../../static/images/slidepic.jpg" width="100%" /></a></div>
          </div>
          <div class="mui-slider-indicator">
            <div class="mui-indicator mui-active"></div>
            <div class="mui-indicator"></div>
            <div class="mui-indicator"></div>
          </div>
        </div>
      </div>
      <!-- 轮播图  end -->
      <!-- 图标列表 -->
      <ul class="mui-row work-icon-list">
        <li @click="go('sanhuiyike')" class="mui-col-xs-4 mui-col-sm-4"><a href="javascript:void(0)">
          <img src="../../static/images/icon_home_zzsh.png" alt="组织生活" />
          <div class="mui-media-body">组织生活</div>
        </a></li>
        <li @click="go('affairs')" class="mui-col-xs-4 mui-col-sm-4"><a href="javascript:void(0)">
          <img src="../../static/images/icon_home_dwgk.png" alt="党务公开" />
          <div class="mui-media-body">党务公开</div>
        </a></li>
        <li @click="go('study')" class="mui-col-xs-4 mui-col-sm-4"><a href="javascript:void(0)">
          <img src="../../static/images/icon_home_zzxx.png" alt="党员学习" />
          <div class="mui-media-body">党员学习</div>
        </a></li>
        <li @click="go('payment')" class="mui-col-xs-4 mui-col-sm-4"><a href="javascript:void(0)">
          <img src="../../static/images/icon_home_dfjn.png" alt="党费缴纳" />
          <div class="mui-media-body">党费缴纳</div>
        </a></li>
        <li @click="go('buildAssess')" class="mui-col-xs-4 mui-col-sm-4"><a href="javascript:void(0)">
          <img src="../../static/images/icon_home_djkh.png" alt="党建资料" />
          <div class="mui-media-body">党建考核</div>
        </a></li>
        <li @click="noUse()" class="mui-col-xs-4 mui-col-sm-4"><a href="#">
          <img src="../../static/images/icon_home_fzdy.png" alt="党员发展" />
          <div class="mui-media-body">党员发展</div>
        </a></li>
      </ul>
    </div>
  </div>
  </layout-content>
</template>

<script>
  import loginService from '@/service/loginService'
  import tools from '@/utils/tools'
  export default {
    name: '',
    data () {
      return {
        user: {
          username: '',
          password: ''
        },
        inputClass: {
          name: false,
          password: false
        },
        swiperOption: {
          pagination: {
            el: '.swiper-pagination'
          }
        },
        qrcode: {},
        userInfo: this.$store.state.userInfo,
        dwbPactchUpApprovaCount: 0,
        workMessage: {},
        showWorkMessageCount: true
      }
    },
    computed: {
      menu () {
        return this.$localStorage.get('arrMenuKey')
      }
    },
    mounted () {
      // window.returnScanResult = this.returnScanResult
      this.needApproveCount()
    },
    methods: {
      go (name) {
        this.$router.push({'name': name})
      },
      goApprove () {
        this.$router.push({path: '/approve/approve'})
      },
      onfocus (key) {
        this.inputClass[key] = true
      },
      onblur (key) {
        this.inputClass[key] = false
      },
      // 打开扫码界面
      capture () {
        window.android.capture()
      },
      // 扫码成功返回
      // returnScanResult (result) {
      //   this.qrcode = result
      //   let data = {"insPartyMeetingId": result.partyMeetingId, "partyMemberId": this.userInfo.partyMemberModel.id}
      //   // let data = {"insPartyMeetingId":"191207224908700093","partyMemberId":this.userInfo.partyMemberModel.id}
      //   loginService.partyMemberSign(data).then((res) => {
      //     if (res.code !== 200) {
      //       this.$createDialog({
      //         type: 'alert',
      //         title: '',
      //         content: res.message,
      //         icon: 'cubeic-alert'
      //       }).show()
      //     } else {
      //       this.$createDialog({
      //         type: 'alert',
      //         title: '',
      //         content:'签到成功',
      //         icon: 'cubeic-alert'
      //       }).show()
      //     }
      //   })
      // },
      // 请求待审批数量
      needApproveCount () {
        loginService.applyList().then(res => {
          if (res.code !== 200) {
            return tools.tip(res.message)
          }
          this.dwbPactchUpApprovaCount = res.data.total
        })
        // loginService.dwbPactchUpApprovaCount().then(res => {
        //   if (res.code === 200) {
        //     this.dwbPactchUpApprovaCount = res.data
        //   }
        // })
      },
      // 是否是党务办
      isDwb () {
        return tools.isDWB()
      },
      noUse () {
        tools.tip('功能即将开放，敬请期待！')
      }
    }
  }
</script>

